//
//  YXVideoView.h
//  YXImageBrowserDemo
//
//  Created by guo peng huang on 2021/5/19.
//


#import <AVFoundation/AVFoundation.h>
#import "YXVideoTopBar.h"
#import "YXVideoActionBar.h"

NS_ASSUME_NONNULL_BEGIN
@class YXVideoView;
@protocol YXVideoViewDelegate <NSObject>

@required

- (BOOL)yx_isFreezingForVideoView:(YXVideoView *)view;

- (void)yx_preparePlayForVideoView:(YXVideoView *)view;

- (void)yx_startPlayForVideoView:(YXVideoView *)view;

- (void)yx_finishPlayForVideoView:(YXVideoView *)view;

- (void)yx_didPlayToEndTimeForVideoView:(YXVideoView *)view;

- (void)yx_playFailedForVideoView:(YXVideoView *)view;

- (void)yx_respondsToTapGestureForVideoView:(YXVideoView *)view;

- (void)yx_cancelledForVideoView:(YXVideoView *)view;

- (CGSize)yx_containerSizeForVideoView:(YXVideoView *)view;

- (void)yx_autoPlayCountChanged:(NSUInteger)count;

@end

@interface YXVideoView : UIView

@property (nonatomic, strong) UIImageView *thumbImageView;

@property (nonatomic, weak) id<YXVideoViewDelegate> delegate;

- (void)updateLayoutWithExpectOrientation:(UIDeviceOrientation)orientation containerSize:(CGSize)containerSize;

@property (nonatomic, strong, nullable) AVAsset *asset;

@property (nonatomic, assign, readonly, getter=isPlaying) BOOL playing;

@property (nonatomic, assign, readonly, getter=isPlayFailed) BOOL playFailed;

@property (nonatomic, assign, readonly, getter=isPreparingPlay) BOOL preparingPlay;

@property (nonatomic, strong, readonly) UITapGestureRecognizer *tapGesture;

- (void)reset;

- (void)hideToolBar:(BOOL)hide;

- (void)hidePlayButton;

- (void)preparPlay;

@property (nonatomic, assign) BOOL needAutoPlay;

@property (nonatomic, assign) NSUInteger autoPlayCount;

@property (nonatomic, strong, readonly) YXVideoTopBar *topBar;
@property (nonatomic, strong, readonly) YXVideoActionBar *actionBar;

@end

NS_ASSUME_NONNULL_END
